<style type="text/css">
.week_item_cell{ cursor:pointer}
.focusbutton {
	border: 1px solid #7eabcd;
	background: url('css/themes/default/images/button_plain_hover.png') repeat-x left bottom;
	_padding: 0px 5px 0px 0px;
	-moz-border-radius: 3px;
	-webkit-border-radius: 3px;
	border-radius: 3px;
}

#westtableID .westtable-span1 {
	font-family :'宋体'
	font-size: 14px;
	color: #2b5875;
	font-weight: bold;
}

#westtableID .westtable-span2 {
	font-family :'宋体'
	font-size: 12px;
	color: #b2b2b2;
	padding-top: 1px;
}

#westtableID .westtablehref {
	cursor: pointer;
	border: none;
	text-decoration: none
}

.west-div-tr-div1 {
	float: left;
	width: 20px;
	margin: 3px;
}

.west-div-tr-div2 {
	float: right;
	padding-top: 10px;
}

.rightlayout-north-cell-line {
	float: left;
	height: 24px;
	border-left: 1px solid #CCC;
	border-right: 1px solid white;
	margin: 2px 8px;
}

.rightlayout-north-cell {
	float: left;
}

#pm_datagrid_center_datagrid_daycontent tr td {
	height: 30px;
	padding-top: 1px;
	padding-bottom: 1px;
	font-size: 12px;
	line-height:30px;
	text-align : center; 
	color: #a9a9a9;
}

#pm_datagrid_center_datagrid_weekcontent tr td {
	height: 30px;
	padding-top: 1px;
	padding-bottom: 1px;
	font-size: 12px;
	line-height:30px;
	text-align : center; 
	color: #a9a9a9;
}

#pm_datagrid_center_month_list_monthcontent {
	width: 750px;
	margin: 0 auto;
}
		
.fc-widget-header {
	border: 1px solid #ccc;
	font-weight:400;
	font-size: 12px;
	background:#efefef;
	height:34px;
	line-height:30px;
	text-align:center;
}
	
</style>
	<div class="easyui-layout" style="width:955px;height:526px;overflow:hidden;margin:0px auto">
	   <div data-options="region:'west',split:false,border:false" style="width:202px;overflow:hidden;">
		   <div id="calendarID"></div>
		   <div style="border:1px solid #99bbe6;margin-top:5px;margin-left:1px;">
			<div style="margin-left: 5px;margin-right: 5px;margin-top: 2px;">
				<table id="westtableID" style="width:100%" cellspacing="16px" cellpadding="0px">
					<tr>
						<td width="200px">
							<div id="pm_west_down_weekvisit_div" class="westtablehref" onclick="showWeekPlanEdit();">
								<div class="west-div-tr-div1">
									<img src="images/icon_weekplan.gif" alt="周计划">
								</div>
								<div class="west-div-tr-div2">
									<span class="westtable-span1">周计划</span><br></br> <span class="westtable-span2">制定行程与计划</span>
								</div>
							</div></td>
					</tr>
				
					<tr>
						<td>
							<div id="pm_west_down_visitplan_div" class="westtablehref" onclick="showFeedbackMain();">
								<div class="west-div-tr-div1">
									<img src="images/icon_call.gif" alt="约定拜访">
								</div>
								<div class="west-div-tr-div2">
									<span class="westtable-span1">约定拜访</span><br></br> <span class="westtable-span2">事先约定客户&nbsp;&nbsp;</span>
								</div>
							</div></td>
					</tr>
					<tr>
						<td>
							<div id="pm_west_down_activity_div" class="westtablehref" onclick="showActivityMain()">
								<div class="west-div-tr-div1">
									<img src="images/icon_activity.gif" alt="会议活动">
								</div>
								<div class="west-div-tr-div2">
									<span class="westtable-span1">会议活动</span><br></br> <span class="westtable-span2">添加活动记录&nbsp;&nbsp;</span>
								</div>
							</div></td>
					</tr>
					<tr>
						<td>
							<div id="pm_west_down_other_div" class="westtablehref" onclick="showOtherEdit()">
								<div class="west-div-tr-div1">
									<img src="images/icon_appointment.gif" alt="其他事项">
								</div>
								<div class="west-div-tr-div2">
									<span class="westtable-span1">其他事项</span><br></br> <span class="westtable-span2">添加其他记录&nbsp;&nbsp;</span>
								</div>
							</div></td>
					</tr>
				</table>
			</div>
		</div>	
		</div>
		<div data-options="region:'center',border:false" style="padding-left:5px;overflow:hidden;">
			<div class="easyui-layout" data-options="fit:true" style="overflow:hidden;">
				<div data-options="region:'north',split:false" style="height:60px;overflow:hidden;width:700px;">
					<div data-options="region:'north',split:false" style="height:58px;background:#dbeaf9;overflow:hidden;">
						<div style="padding-top:3px;">
							<div id="rightnorthleft">
								<a href="javascript:void(0);" onclick="beforeOrAfterDate('-');" class="easyui-linkbutton" data-options="iconCls:'icon-back-oval',plain:true"></a>
								&nbsp;<a href="javascript:void(0);" onclick="beforeOrAfterDate('+');" class="easyui-linkbutton" data-options="iconCls:'icon-next',plain:true"></a>
								&nbsp;<select id="pm_usersearch_combox" style="width:100px;"></select>
								<div id="rightnorthright" style="float:right;">
									<!--
                                         <div class="rightlayout-north-cell">
										<a href="javascript:void(0)" onclick="alert('行程')" class="easyui-linkbutton" data-options="plain:true">行程</a>
									</div>
									<div class="rightlayout-north-cell-line"></div>
									-->
									
									<div class="rightlayout-north-cell" id="pm_datagrid_center_day_button">
										<a href="javascript:void(0)" onclick="javascript:tipDay();" class="easyui-linkbutton" data-options="plain:true">日</a>
									</div>
									<div class="rightlayout-north-cell-line"></div>
									<div class="rightlayout-north-cell" id="pm_datagrid_center_week_button">
										<a href="javascript:void(0)" onclick="tipWeek();" class="easyui-linkbutton" data-options="plain:true">周</a>
									</div>
									<div class="rightlayout-north-cell-line"></div>
									<div class="rightlayout-north-cell" id="pm_datagrid_center_month_button">
										<a href="javascript:void(0)" onclick="tipMonth();" class="easyui-linkbutton" data-options="plain:true">月份</a>
									</div>
									<div class="rightlayout-north-cell-line"></div>
									<div class="rightlayout-north-cell" id="pm_datagrid_center_list_button">
										<a href="javascript:void(0)" onclick="tipList();" class="easyui-linkbutton" data-options="plain:true">列表</a>
									</div>
									<div class="rightlayout-north-cell-line"></div>
									<div class="rightlayout-north-cell">
										<a href="javascript:void(0);" onclick="refresh();" class="easyui-linkbutton" data-options="iconCls:'icon-refresh',plain:true"></a>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				
                <div data-options="region:'south',split:false" style="height:30px;border: none;padding-top:2px;overflow:hidden;">
					<div style="padding: 1px;padding: 1px;float: right;">
						<a class="easyui-linkbutton" onclick="getWorkSummary()" data-options="iconCls:'icon-assessment',plain:true">周工作总结</a>
					</div>
				</div>
				
				<div data-options="region:'center'" style="border-top:none;overflow:hidden;">
					<div id="pm_datagrid_center_day_week" style="width:100%;height:100%;display:block;overflow:hidden;">
						<div id="pm_datagrid_center_datagrid" style="width:100%;height:100%;overflow:hidden;">
							<div class="easyui-layout" data-options="fit:true,border:false" style="width:100%;overflow:hidden;">
								<div data-options="region:'west',split:false" style="width:60px;border:none;background:#efefef;overflow:hidden;">
									<table style="padding: 0;border: none;" cellspacing=0 cellpadding=0 >
										<tr>
											<td style="width:60px; height:30px;padding: 0px; border-bottom:1px solid #ffffff;border-right:1px solid #ffffff"></td>
										</tr>
										<tr>
											<td style="width:60px; height:225px; border-bottom:1px solid #99bbe6;padding:0;text-align: center;border-right:1px solid #99bbe6">上午</td>
										</tr>
										<tr>
											<td style="width:60px; height:225px;;text-align: center;border-right:1px solid #99bbe6;overflow: hidden;">下午</td>
										</tr>
									</table>
								</div>
								<div data-options="region:'center'" style="border-left:none;overflow:hidden;padding:0;border-bottom:none;border-top:none;border-right:none">
									<!--------------- day ------------->
									<div id="pm_datagrid_center_datagrid_daycontent" style="display:block;overflow:hidden;">
										<div id="pm_datagrid_center_datagrid_daycontent_title" style="width:100%; height:30px; border-bottom:1px solid #99bbe6;background: #efefef;text-align: center;line-height: 30px;font-size: 13px;font-weight:400;overflow:hidden;font-family :'宋体'">2012-11-19 周一</div>
										<div style="width:100%;height: 225px;border-bottom: 1px solid #99bbe6;overflow-x: hidden;overflow-y:auto;">
											<table id="pm_datagrid_center_datagrid_daycontent_up"></table>
										</div>
										<div style="width:100%;height: 225px;overflow-x: hidden;overflow-y:auto;">
											<table id="pm_datagrid_center_datagrid_daycontent_down" ></table>
										</div>
									</div>
									<!------------ day -------------->
									<!----------------------- week --------------------->
									<div id="pm_datagrid_center_datagrid_weekcontent" style="display:none;overflow:hidden;">
										<div id="pm_datagrid_center_datagrid_weekcontent_title" style="width:100%; height:30px; border-bottom:1px solid #99bbe6;background: #efefef;text-align: center;line-height: 30px;font-size: 13px;font-weight:400;overflow:hidden;font-family :'宋体'">2012-11-25 ~ 2012-12-01</div>
										<div style="width:100%;height:225px;border-bottom: 1px solid #99bbe6;overflow-x: hidden;">
											<table id="pm_datagrid_center_datagrid_weekcontent_up"></table>
										</div>
										<div style="width:100%;height:225px;overflow-x: hidden;">
											<table id="pm_datagrid_center_datagrid_weekcontent_down"></table>
										</div>
									</div>
									<!----------------------- week --------------------->
									<!------------- dialog ------------------->
									<div id="dialogID"></div>
								</div>
							</div>
						</div>
					</div>
					
					<!--  month-list-->
					<div id="pm_datagrid_center_month_list" style="width:100%;height:100%;display:none;">
					        <!-------- List ---------->
						    <div id="pm_datagrid_center_month_list_listcontent" style="width:100%;height:100%;display:none;">
								<div id="pm_datagrid_center_month_list_listcontent_layout" style="width:100%">
									<div data-options="region:'west',split:false" style="width:240px;border-top:none;border-bottom:none;border-left:none;border-right:3px solid #99bbe8;">
										<table id="pm_datagrid_center_month_list_left"></table>
									</div>
									<div data-options="region:'center'" style="padding:0px;border-top:none;border-bottom:none;border-right:none;">
										<div id="pm_datagrid_center_month_list_right"></div>
									</div>
							    </div>
						    </div>
							<!----------- Month ---------->
							 <div id="pm_datagrid_center_month_list_montbcontent" style="width:100%;height:100%;display:none;">
								<div id="pm_datagrid_center_month_list_monthcontent_layout" style="width:100%">
									<div data-options="region:'center',fit:true" style="padding:0px;border-top:none;border-bottom:none;border-right:none;overflow:hidden;">
										<div id="pm_datagrid_center_month_list_monthcontent"></div>
									</div>
							    </div>
						    </div>
					</div>
					<!--  month-list-->
					
				</div>
			</div>

		</div>
		
		
</div>
	<!-- fevin -->
	<div id="dlg-wpe" class="easyui-dialog" title="周行程与计划制定" style="width:750px;height:500px;"
			data-options="buttons:'#dlg-wpe-btn',resizable:false,closed:true,modal:true">
	</div>  
	<div id="dlg-wpe-btn" style="background:#dbeaf9;">
		<a href="#" id="copyWeekPlanBtn" class="easyui-linkbutton" onclick="javascript:copyWeekPlanTemp();">&nbsp;&nbsp;复制&nbsp;&nbsp;</a>
		<a href="#" class="easyui-linkbutton" onclick="javascript:$('#dlg-wpe').dialog('close')">&nbsp;&nbsp;关闭&nbsp;&nbsp;</a>
	</div>
	
	<div id="dlg-ydm" class="easyui-dialog" title="约定拜访" style="background:#dbeaf9;width:450px;height:280px;"
			data-options="buttons:'#dlg-ydm-btn',resizable:false,closed:true,modal:true">
	</div>
	
	<div id="dlg-atm" class="easyui-dialog" title="会议活动" style="background:#dbeaf9;width:450px;height:280px;"
			data-options="buttons:'#dlg-atm-btn',resizable:false,closed:true,modal:true">
	</div>
	<div id="dlg-atm-btn" style="background:#dbeaf9;">
		<a href="#" id="editActivityBtn" class="easyui-linkbutton" data-options="iconCls:'icon-edit'" onclick="javascript:showActivityEdit();">反馈</a>
		<a href="#" id="delActivityBtn" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="javascript:deleteActivity();">删除</a>
		<a href="#" id="saveActivityBtn" class="easyui-linkbutton" onclick="javascript:saveActivity();">&nbsp;&nbsp;保存&nbsp;&nbsp;</a>
		<a href="#" class="easyui-linkbutton" onclick="javascript:$('#dlg-atm').dialog('close')">&nbsp;&nbsp;关闭&nbsp;&nbsp;</a>
	</div>
	<div id="dlg-ote" class="easyui-dialog" title="其他事项" style="background:#dbeaf9;width:450px;height:280px;"
			data-options="buttons:'#dlg-ote-btn',resizable:false,closed:true,modal:true">
	</div>
	<div id="dlg-ote-btn" style="background:#dbeaf9;">
		<a href="#" id="delOtherBtn" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="javascript:deleteOtherInfo();">删除</a>
		<a href="#" id="saveOtherBtn" class="easyui-linkbutton" onclick="javascript:saveOtherInfo();">&nbsp;&nbsp;保存&nbsp;&nbsp;</a>
		<a href="#" class="easyui-linkbutton" onclick="javascript:$('#dlg-ote').dialog('close')">&nbsp;&nbsp;关闭&nbsp;&nbsp;</a>
	</div>
	
	<div id="createContainer"></div>

<script type="text/javascript">
	var ovaldate = new Date();
	var ovaldateStr = formatCalendarDate(ovaldate,'-');
	var oval_user_search;
	var pm_datagrid_center_datagrid_daycontent_up, pm_datagrid_center_datagrid_daycontent_down,
	pm_datagrid_center_datagrid_weekcontent_up, pm_datagrid_center_datagrid_weekcontent_down;
	var user_combobox,pm_datagrid_center_month_list_left,pm_datagrid_center_month_list_right;
	var dayShow = true, weekShow = false,monthShow = false,listShow = false;
	$(function() {
		$('#pm_datagrid_center_day_button').addClass('focusbutton');
		//获取日数据
		getVisiptplanDayData();
		//显示日历控件
		$('#calendarID').calendar({
			width : 202,
			border:'#99bbe6',
			height : 202,
			onSelect : function(date) {
				getDayTitleDate(date);
				ovaldateStr = formatCalendarDate(ovaldate,'-');
				calendarTipRefresh(date);
			}
		});
		

	});

	/**
	* 日调用job获取数据
	*/
	function getVisiptplanDayData() {
		var variable = new Array('__methodName', '__token', 'pagename', 'actionname','__params');
		var value = new Array('wsActionJSON', token, 'p_visitfeedbackday', 'dayshow',"{'currentdate':'"+ovaldateStr+"'}");
		var dataStr = getJsonData(variable, value);
		connectionServlet(dataStr, VisiptplanDayDataReturn);
	};
    /**
	* 日获取数据回调函数

	*/
	function VisiptplanDayDataReturn(data) {
	    getDayTitleDate(ovaldate);
		var amRowsData, pmRowsData,tempResult,userData;
		if(data.successflag=="false"){
			 window.location.href="Error.html";
			 return ;
		}
		tempResult = data.result;
		if(typeof (tempResult) == 'undefined'){
		     return ;
		}		
		if(typeof (tempResult.amrows) != 'undefined'){
		   amRowsData = tempResult.amrows;
		}else{
		    amRowsData = [];
		}
		if(typeof (tempResult.pmrows) != 'undefined'){
		    pmRowsData = tempResult.pmrows;
		}else{
		    pmRowsData = [];
		}
		if(typeof (tempResult.userdata) != 'undefined'){
		    userData = tempResult.userdata;
		}else{
		    userData = [];
		}
		pm_datagrid_center_datagrid_daycontent_up = $('#pm_datagrid_center_datagrid_daycontent_up').datagrid({
			fitColumns : true,
			singleSelect : true,
			border : false,
			height : 225,
			columns : [ [ {
				field : 'activitytype',
				title : '工作类型',
				width : 100,
				align : 'left',
				resizable : false,
				formatter : function(value, rowData, rowIndex) {
				   if(value  == 1){
				       return '<img src="images/visit.gif" width="25px" height="25px"/>&nbsp;&nbsp;' + '拜访客户';
				   }
				   if(value  == 2){
				        return '<img src="images/other.gif" width="25px" height="25px"/>&nbsp;&nbsp;' + '其他事项';
				   }
				   if(value  == 3){
				        return '<img src="images/meeting.gif" width="25px" height="25px"/>&nbsp;&nbsp;' + '会议活动';
				   }
				}
			}, {
				field : 'groupstr',
				title : '工作信息',
				resizable : false,
				width : 300,
				align : 'right',
				formatter:function(value, rowData, rowIndex) {
				     var dataValue = value.split('|');
					 var showStr='';
					 if(dataValue.length>0){
					     for(var i =0;i<dataValue.length;i++){
						     if(i>0){
							    showStr +='&nbsp;|&nbsp;';
							 }
						     showStr += dataValue[i];
						 }
						return showStr; 
					 }else{
					     return ''; 
					 }
				}
			} ] ],
			onClickRow : function(rowIndex, rowData) {
				if(rowData.activitytype==2)
					selectModel(rowData.activitytype, rowData.visitotherinfoid);
				else
					selectModel(rowData.activitytype,rowData.visitfeedbackid);
			}
		});
		pm_datagrid_center_datagrid_daycontent_up.datagrid('loadData', amRowsData);

		pm_datagrid_center_datagrid_daycontent_down = $('#pm_datagrid_center_datagrid_daycontent_down').datagrid({
			fitColumns : true,
			singleSelect : true,
			border : false,
			height:225,
			showHeader:false,
			columns : [ [ {
				field : 'activitytype',
				title : '工作类型',
				width : 100,
				resizable : false,
				align : 'left',
				formatter : function(value, rowData, rowIndex) {
				 if(value  == 1){
				       return '<img src="images/visit.gif" width="25px" height="25px"/>&nbsp;&nbsp;' + '拜访客户';
				   }
				   if(value  == 2){
				        return '<img src="images/other.gif" width="25px" height="25px"/>&nbsp;&nbsp;' + '其他事项';
				   }
				   if(value  == 3){
				        return '<img src="images/meeting.gif" width="25px" height="25px"/>&nbsp;&nbsp;' + '会议活动';
				   }
				}
			}, {
				field : 'groupstr',
				title : '工作信息',
				width : 300,
				resizable : false,
				align : 'right',
				formatter:function(value, rowData, rowIndex) {
				     var dataValue = value.split('|');
					 var showStr='';
					 if(dataValue.length>0){
					     for(var i =0;i<dataValue.length;i++){
						     if(i>0){
							    showStr +='&nbsp;|&nbsp;';
							 }
						     showStr += dataValue[i];
						 }
						return showStr; 
					 }else{
					     return ''; 
					 }
				}
			} ] ],
			onClickRow : function(rowIndex, rowData) {//console.info(rowData.visitfeedbackid);
				if(rowData.activitytype==2)
					selectModel(rowData.activitytype, rowData.visitotherinfoid);
				else
					selectModel(rowData.activitytype,rowData.visitfeedbackid);
			}
		});
		pm_datagrid_center_datagrid_daycontent_down.datagrid('loadData', pmRowsData);
		
		
		//UserSearch
		user_combobox = $('#pm_usersearch_combox').combobox({
			valueField : 'userid',
			textField : 'employeename',
			panelHeight : 50

		});
		user_combobox.combobox('loadData', userData);
		// 取得下拉列表的值 
	    oval_user_search = user_combobox.combobox('getValue');

	}

	

	/**
	*日拜访的标题日历显示
	*/
	function getDayTitleDate(date) {
		var dateStr = formatCalendarDate(date, '-');
		var weekStr = getWeek(date);
		$('#pm_datagrid_center_datagrid_daycontent_title').html(dateStr + '&nbsp;' + weekStr);
	}
	/**
	* 点击天按钮

	*/
	function tipDay() {
		dayShow = true;
		weekShow = false;
		monthShow = false;
		listShow = false;
		$('#pm_datagrid_center_day_button').addClass('focusbutton');
		$('#pm_datagrid_center_week_button').removeClass('focusbutton');
		$('#pm_datagrid_center_month_button').removeClass('focusbutton');
		$('#pm_datagrid_center_list_button').removeClass('focusbutton');
		$('#pm_datagrid_center_day_week').css('display', 'block');
		$('#pm_datagrid_center_month_list').css('display', 'none');
		$('#pm_datagrid_center_datagrid_daycontent').css('display', 'block');
		$('#pm_datagrid_center_datagrid_weekcontent').css('display', 'none');
		$('#pm_datagrid_center_month_list_montbcontent').css('display', 'none');
		//取得 day 数据
		ovaldate = new Date();
		ovaldateStr = formatCalendarDate(ovaldate,'-');
		$('#calendarID').calendar('moveTo', ovaldate);
		getVisiptplanDayData();
	}

	/**
	* 点击周按钮

	*/
	function tipWeek() {
		dayShow = false;
		weekShow = true;
		monthShow = false;
		listShow = false;
		$('#pm_datagrid_center_day_button').removeClass('focusbutton');
		$('#pm_datagrid_center_week_button').addClass('focusbutton');
		$('#pm_datagrid_center_month_button').removeClass('focusbutton');
		$('#pm_datagrid_center_list_button').removeClass('focusbutton');
		$('#pm_datagrid_center_day_week').css('display', 'block');
		$('#pm_datagrid_center_month_list').css('display', 'none');
		$('#pm_datagrid_center_datagrid_daycontent').css('display', 'none');
		$('#pm_datagrid_center_datagrid_weekcontent').css('display', 'block');
		$('#pm_datagrid_center_month_list_montbcontent').css('display', 'none');
		//取得 week 数据
		ovaldate = new Date();
		ovaldateStr = formatCalendarDate(ovaldate,'-');
		$('#calendarID').calendar('moveTo', ovaldate);
		getVisiptplanWeekData();
	}
	
	/**
	* 周调用job获取数据
	*/
	function getVisiptplanWeekData(){
		var variable = new Array('__methodName', '__token', 'pagename', 'actionname','__params');
		var value = new Array('wsActionJSON', token, 'p_visitfeedbackday', 'weekshow',"{'currentdate':'"+ovaldateStr+"'}");
		var dataStr = getJsonData(variable, value);
		connectionServlet(dataStr, VisiptplanWeekDataReturn);
	}
	
	/**
	* 周获取数据回调函数

	*/
	function VisiptplanWeekDataReturn(data){
	    var amRowsData, pmRowsData,tempResult,userData,dateData;
		if(!data.successflag){
		     return ;
		}
		tempResult = data.result;
		
        if(typeof (tempResult.dates) != 'undefined'){
		     $('#pm_datagrid_center_datagrid_weekcontent_title').html(tempResult.dates.weekrange);
		}	
        if(typeof (tempResult) == 'undefined'){
		     return ;
		}		
		if(typeof (tempResult.weekamlist) != 'undefined'){
		   amRowsData = tempResult.weekamlist;
		}else{
		    amRowsData = [];
		}
		if(typeof (tempResult.weekpmlist) != 'undefined'){
		   pmRowsData = tempResult.weekpmlist;
		}else{
		    pmRowsData = [];
		}
		//Week
		pm_datagrid_center_datagrid_weekcontent_up = $('#pm_datagrid_center_datagrid_weekcontent_up').datagrid({
			fitColumns : true,
			striped : true,
			nowrap : true,
			border : false,
			height : 225,
			columns : [ [ {
				field : 'sundaydata',
				title : '周日',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 0) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				        if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						    return '<span title="'+value+'" onmouseover=onmouseoverTd(this,0,0) onmouseout = onmouseoverTd(this,0,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			}, {
				field : 'mondaydata',
				title : '周一',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 1) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				       if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						    return '<span title="'+value+'" onmouseover=onmouseoverTd(this,1,0) onmouseout = onmouseoverTd(this,1,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			}, {
				field : 'tuesdaydata',
				title : '周二',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 2) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				       if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						    return '<span title="'+value+'" onmouseover=onmouseoverTd(this,2,0) onmouseout = onmouseoverTd(this,2,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			}, {
				field : 'wendaydata',
				title : '周三',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 3) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				        if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						    return '<span title="'+value+'" onmouseover=onmouseoverTd(this,3,0) onmouseout = onmouseoverTd(this,3,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			}, {
				field : 'thusdaydata',
				title : '周四',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 4) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				        if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						    return '<span title="'+value+'" onmouseover=onmouseoverTd(this,4,0) onmouseout = onmouseoverTd(this,4,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			}, {
				field : 'fridaydata',
				title : '周五',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 5) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				        if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						    return '<span title="'+value+'" onmouseover=onmouseoverTd(this,5,0) onmouseout = onmouseoverTd(this,5,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			}, {
				field : 'saturdaydata',
				title : '周六',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 6) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				        if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						    return '<span title="'+value+'" onmouseover=onmouseoverTd(this,6,0) onmouseout = onmouseoverTd(this,6,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			} ] ],
			rowStyler : function(rowIndex, rowData) {
				return 'background:#fff';
			},
			onClickCell:function(rowIndex, field, value){
                if(value != null){		   
			        var stringArray = value.split(',');
					if(stringArray.length==5){
					    ovaldateStr= stringArray[4];
						selectModel(stringArray[3],stringArray[2]);
					}else{
					    ovaldateStr= stringArray[3];
                        selectModel(stringArray[2],stringArray[1]);					
					}
				}	
			}

		});
		pm_datagrid_center_datagrid_weekcontent_up.datagrid('loadData', amRowsData);

		pm_datagrid_center_datagrid_weekcontent_down = $('#pm_datagrid_center_datagrid_weekcontent_down').datagrid({
			fitColumns : true,
			singleSelect : true,
			striped : true,
			nowrap : true,
			border : false,
			height:225,
			showHeader:false,
			columns : [ [ {
				field : 'sundaydata',
				title : '周日',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 0) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				       if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						    return '<span title="'+value+'" onmouseover=onmouseoverTd(this,0,0) onmouseout = onmouseoverTd(this,0,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			}, {
				field : 'mondaydata',
				title : '周一',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 1) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				        if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						    return '<span title="'+value+'" onmouseover=onmouseoverTd(this,1,0) onmouseout = onmouseoverTd(this,1,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			}, {
				field : 'tuesdaydata',
				title : '周二',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 2) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				        if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						    return '<span title="'+value+'" onmouseover=onmouseoverTd(this,2,0) onmouseout = onmouseoverTd(this,2,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			}, {
				field : 'wendaydata',
				title : '周三',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 3) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				        if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						    return '<span title="'+value+'" onmouseover=onmouseoverTd(this,3,0) onmouseout = onmouseoverTd(this,3,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			}, {
				field : 'thusdaydata',
				title : '周四',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 4) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				        if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						     return '<span title="'+value+'" onmouseover=onmouseoverTd(this,4,0) onmouseout = onmouseoverTd(this,4,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			}, {
				field : 'fridaydata',
				title : '周五',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 5) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				        if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						     return '<span title="'+value+'" onmouseover=onmouseoverTd(this,5,0) onmouseout = onmouseoverTd(this,5,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
				}
			}, {
				field : 'saturdaydata',
				title : '周六',
				width : 100,
				align : 'center',
				resizable : false,
				styler : function(value, row, index) {
					if (new Date().getDay() == 6) {
						return 'background:#fef8b4;';
					}
				},
				formatter :function(value,row,index){
				    if(typeof value != 'undefined'){
				        if(value != null){		        
							var stringArray = value.split(',');
							value = stringArray[0];
						    return '<span title="'+value+'" onmouseover=onmouseoverTd(this,6,0) onmouseout = onmouseoverTd(this,6,1)>'+value+'</span>';
						}else{
						    return '';
						}
				    }
			}		 
			} ] ],
			rowStyler : function(rowIndex, rowData) {
				return 'background:#fff';
			},
			onClickCell:function(rowIndex, field, value){
                if(value != null){		   
			        var stringArray = value.split(',');
					if(stringArray.length==5){
					    ovaldateStr= stringArray[4];
						selectModel(stringArray[3],stringArray[2]);
					}else{
					    ovaldateStr= stringArray[3];
                        selectModel(stringArray[2],stringArray[1]);					
					}
				}	
			}

		});
		pm_datagrid_center_datagrid_weekcontent_down.datagrid('loadData', pmRowsData);
		
	}
	
	function onmouseoverTd(obj,day,sign){
	   var $parent = $(obj).parent().parent();
	   //$parent[0].localName
	    if(sign == 0){
	         $parent.css('background-color','#dbeaf9');
	    }else{
		     if(new Date().getDay() == day){
			      $parent.css('background-color','#fef8b4');
			}else{
			     $parent.css('background-color','#ffffff');
			}
		}
		$parent.addClass("week_item_cell");
	   
	}

	/**
	 *在日、周、月视图的情况下根据不同情况处理前一天后一天、前一周后一周、前一个月后一个月控制
	 */
	 var transfer_orgid; //在list的时候使用，作为变量传递

	function beforeOrAfterDate(sign) {
		//如果当前显示位天 即 dayShow = true
		if(dayShow){
		    ovaldate = getYestodayOrTomorrow(ovaldate, sign);
			ovaldateStr = formatCalendarDate(ovaldate,'-');
			$('#calendarID').calendar('moveTo', ovaldate);
			getVisiptplanDayData();
		}
		//如果当前显示位周 即 weekShow = true
		if(weekShow){
			var getweekdate = beforeOrAfterWeek(ovaldate,sign).split(",")[0];
			var splitStr = getweekdate.split('-');
			ovaldate = new Date(splitStr[0],splitStr[1]-1,splitStr[2]);
			ovaldateStr = formatCalendarDate(ovaldate,'-');
			$('#calendarID').calendar('moveTo', ovaldate);
		    getVisiptplanWeekData();
		}
		//如果当前显示位月 即 monthShow = true
		if(monthShow){
		    ovaldate = beforeOrAfterMonth(sign);
		    ovaldateStr = formatCalendarDate(ovaldate,'-');
		    $('#calendarID').calendar('moveTo', ovaldate);
		    getMonthData();
		}
		//如果当前显示位列表 即 listShow = true
		if(listShow){
		    var getweekdate = beforeOrAfterWeek(ovaldate,sign).split(",")[0];
			var splitStr = getweekdate.split('-');
			ovaldate = new Date(splitStr[0],splitStr[1]-1,splitStr[2]);
			ovaldateStr = formatCalendarDate(ovaldate,'-');
			$('#calendarID').calendar('moveTo', ovaldate);
		    getListItemData(transfer_orgid);
		}
		var visitplan_div = $('#pm_west_down_visitplan_div');
		var activity_div = $('#pm_west_down_activity_div');
		var other_div = $('#pm_west_down_other_div');
		if(divYesOrNoTip(ovaldate)){
		     visitplan_div.attr('disabled',true);
			 activity_div.attr('disabled',true);
			 other_div.attr('disabled',true);
		}else{
			 visitplan_div.attr('disabled',false);
			 activity_div.attr('disabled',false);
			 other_div.attr('disabled',false);
		}
	
	}
	
	 
	/**
	 *周视图上一周下一周计算

	 *注释部分为计算本周开始和结束日期
	 *sign 为是上一周还是下一周的标记 - , +
	 */
	 function beforeOrAfterMonth(sign){
	    var this_date = ovaldate;
		var this_year = this_date.getFullYear();
		var this_month = this_date.getMonth();
	     if(sign == '-'){
		    this_month = this_month - 1;
		 }else{
		    this_month = this_month + 1;
		 }
		 return new Date(this_year,this_month,'01');
	 }
	
	/**
	 *处理div是否有点击事件

	 */
	function divYesOrNoTip(ovaldate) {
        var currentDate = new Date();
		var beforeDate = new Date();
		var finalBeforeTime = beforeDate.setDate(currentDate.getDate() - currentDate.getDay() - 1);
		var finalAfterTime = beforeDate.setDate(currentDate.getDate() - currentDate.getDay() + 6 );
		var ovaldateTime = ovaldate.getTime();
		if(finalBeforeTime > ovaldateTime || finalAfterTime < ovaldateTime){
		     return true;
		}else{
		       return false;
		}
	}
	
	

	/**
	 * 取得周视图中的标题（日期时间段）
	 * @return {String}
	 
	function getWeekTitleDate(theDay) {
		ovaldate = theDay;
		var monday = new Date(theDay.getTime());
		var sunday = new Date(theDay.getTime());
		monday.setDate(monday.getDate() - monday.getDay());
		sunday.setDate(sunday.getDate() + 6 - sunday.getDay());
		var mondayStr = formatCalendarDate(monday, "-");
		var sundayStr = formatCalendarDate(sunday, "-");
		$('#pm_datagrid_center_datagrid_weekcontent_title').html(mondayStr + "~" + sundayStr);
	};*/
	

	/**
	 * 获取当前日期的前一天Method
	 * 
	 */
	function getYestodayOrTomorrow(date, sign) {
		var yesterday_milliseconds = eval(date.getTime() + sign + 1000 * 60 * 60 * 24);
		var yesterday = new Date();
		yesterday.setTime(yesterday_milliseconds);
		var strYear = yesterday.getFullYear();
		var strDay = yesterday.getDate();
		if (strDay < 10) {
			strDay = "0" + strDay;
		}
		var strMonth = yesterday.getMonth();
		if (strMonth < 10) {
			strMonth = "0" + strMonth;
		}
		return new Date(strYear, strMonth, strDay);
	}
	
	/**
	 * 点击列表显示
	 * 
	 */
	function tipList() {
	     dayShow = false;
		 weekShow = false;
		 monthShow = false;
		 listShow = true;
	     $('#pm_datagrid_center_day_button').removeClass('focusbutton');
		 $('#pm_datagrid_center_week_button').removeClass('focusbutton');
		 $('#pm_datagrid_center_month_button').removeClass('focusbutton');
		 $('#pm_datagrid_center_list_button').addClass('focusbutton');
	     $('#pm_datagrid_center_day_week').css('display', 'none');
		 $('#pm_datagrid_center_month_list').css('display', 'block');
		 $('#pm_datagrid_center_month_list_listcontent').css('display', 'block');
		 $('#pm_datagrid_center_month_list_left').css('display', 'block');
		 $('#pm_datagrid_center_month_list_montbcontent').css('display', 'none');
		 $('#pm_datagrid_center_month_list_listcontent_layout').layout({fit:true,border:false});
		 ovaldate = new Date();
		 ovaldateStr = formatCalendarDate(ovaldate,'-');
		 $('#calendarID').calendar('moveTo', ovaldate);
		 tipListGetData();
		
	}
	/**
	 * 获取列表数据
	 * 
	 */
	function tipListGetData() {
		var variable = new Array('__methodName', '__token', 'pagename', 'actionname', '__params');
		var value = new Array('wsActionJSON', token, 'p_visitfeedbackday', 'listshow',"{'currentdate':'"+ovaldateStr+"'}");
		var dataStr = getJsonData(variable, value);
		connectionServlet(dataStr, getListDataReturn);
	}

	/**
	 * 解析列表数据
	 * 
	 */
	function getListDataReturn(data) {
	    var rowsData,tempResult;	
		if(!data.successflag){
		     return ;
		}
		tempResult = data.result;	
        if(typeof (tempResult) == 'undefined'){
		     return ;
		}	
		if(typeof (tempResult.listdata) != 'undefined'){
		   rowsData = tempResult.listdata;
		}else{
		    rowsData = [];
		}	
		    pm_datagrid_center_month_list_left = $('#pm_datagrid_center_month_list_left').datagrid({
			title : '机构',
			rownumbers : true,
			fitColumns : true,
			singleSelect : true,
			striped : true,
			fit:true,
			height:440,
			nowrap : true,
			border : false,
			columns : [[{
				field : 'orgname',
				title : '机构',
				width : 240,
				resizable : false,
				align : 'left',
				formatter : function(value, rowData, rowIndex) {
					return '<span title='+value+'>' + value + '</span>';
				}
			}]],
			onClickRow:function(rowIndex, rowData){
			        transfer_orgid = rowData.orgid;
					getListItemData(rowData.orgid);
					
			}
		});		
		pm_datagrid_center_month_list_left.datagrid('loadData', rowsData);
		
		pm_datagrid_center_month_list_right = $('#pm_datagrid_center_month_list_right').datagrid({
			title : '事物列表',
			rownumbers : true,
			fitColumns : true,
			singleSelect : true,
			striped : true,
			fit:true,
			height:440,
			nowrap : true,
			border : false,
			columns : [[{
				field : 'targettype',
				title : '拜访类型',
				width : 150,
				resizable : false,
				align : 'left',
				formatter : function(value, rowData, rowIndex) {
					if(value == 1){
					    return '<span>拜访</span>';
					}
					if(value == 2){
					    return '<span>活动</span>';
					}
				}
			},{
				field : 'feedbackdate',
				title : '机构名称',
				width : 150,
				resizable : false,
				align : 'left',
				formatter : function(value, rowData, rowIndex) {
					return '<span title='+value+'>' + value + '</span>';
				}
			}]],
			groupField:'feedbackdate',
		    view: groupview,
		    groupFormatter:function(value, rows){
				var dateStr = value.split('-');
				var changeDate = new Date(dateStr[0], dateStr[1]-1,dateStr[2]);
			    return value +"("+getWeek(changeDate)+")";
		    }
		});
	}
	
	/**
	 * 获取列表每一项明细数据

	 * 
	 */
	function getListItemData(orgid) {
		var variable = new Array('__methodName', '__token', 'pagename', 'actionname', '__params');
		var value = new Array('wsActionJSON', token, 'p_visitfeedbackday', 'listitemshow',"{'currentdate':'"+ovaldateStr+"','orgid':"+orgid+"}");
		var dataStr = getJsonData(variable, value);
		connectionServlet(dataStr, ggetListItemDataReturn);
	}
	/**
	 * 解析列表左侧的每一项数据

	 * 
	 */
	function ggetListItemDataReturn(data){
	    var rowsData,tempResult;	
		if(!data.successflag){
		     return ;
		}
		tempResult = data.result;	
        if(typeof (tempResult) == 'undefined'){
		     return ;
		}	
		if(typeof (tempResult.listdata) != 'undefined'){
		   rowsData = tempResult.listdata;
		}else{
		    rowsData = [];
		}	
	     //right	
		pm_datagrid_center_month_list_right.datagrid('loadData', rowsData);
	}
	
	
	function tipMonth(){
	     dayShow = false;
		 weekShow = false;
		 monthShow = true;
		 listShow = false;
		 $('#pm_datagrid_center_day_button').removeClass('focusbutton');
		 $('#pm_datagrid_center_week_button').removeClass('focusbutton');
		 $('#pm_datagrid_center_month_button').addClass('focusbutton');
		 $('#pm_datagrid_center_list_button').removeClass('focusbutton');
	     $('#pm_datagrid_center_day_week').css('display', 'none');
		 $('#pm_datagrid_center_month_list').css('display', 'block');
		 $('#pm_datagrid_center_month_list_listcontent').css('display', 'none');
		 $('#pm_datagrid_center_month_list_montbcontent').css('display', 'block');
		 ovaldate = new Date();
		 ovaldateStr = formatCalendarDate(ovaldate,'-');
		 $('#calendarID').calendar('moveTo', ovaldate);
		 getMonthData();
	}
	
	
	/**
	 * 月调用job获取数据
	 * 
	 */
	function getMonthData() {
        var variable = new Array('__methodName', '__token', 'pagename', 'actionname','__params');
		var value = new Array('wsActionJSON', token, 'p_visitfeedbackday', 'monthshow',"{'currentdate':'"+ovaldateStr+"'}");
		var dataStr = getJsonData(variable, value);
		connectionServlet(dataStr, getMonthDataReturn);
	}
	/**
	 * 月获取数据回调函数

	 * 
	 */
	function getMonthDataReturn(data){
	    var tempResult,eventData;
		if(!data.successflag){
		     return ;
		}
		tempResult = data.result;
		if(typeof (tempResult) == 'undefined'){
		     return ;
		}
        if(typeof (tempResult.monthinfolist) != 'undefined'){
		    eventData = tempResult.monthinfolist;
		}else{
		    eventData = [];
		}
		
		$('#pm_datagrid_center_month_list_monthcontent').fullCalendar({
		    year:ovaldate.getFullYear(),
			month:ovaldate.getMonth(),
			day:ovaldate.getDate(),
			header: false,
			dayNames: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
		    dayNamesShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
			weekMode:'liquid',
			height: 520,
			contentHeight:485,
			aspectRatio: 1.25,
			events:eventData,
			dayClick: function(date, allDay, jsEvent, view) {
			    fromMonthToDay(date);
			},
			eventColor: '#378006',
			eventMouseover:function( event, jsEvent, view ) {
				 $(this).addClass('week_item_cell');
			},
            eventMouseout:function( event, jsEvent, view ) { 
			},
            eventClick: function(calEvent, jsEvent, view) {
			    fromMonthToDay(calEvent.start);
			}
		});	
		
		
	}
	
	/**
	* 刷新方法
	*/
	function refresh(){
	     if(dayShow){
			getVisiptplanDayData();
		}
		//如果当前显示位周 即 weekShow = true
		if(weekShow){
		    getVisiptplanWeekData();
		}
		//如果当前显示位月 即 monthShow = true
		if(monthShow){
		    getMonthData();
		}
		//如果当前显示位列表 即 listShow = true
		if(listShow){
		    getListItemData(transfer_orgid);
		}
	}
	
	function fromMonthToDay(date){
	    dayShow = true;
		weekShow = false;
		monthShow = false;
		listShow = false;
		$('#pm_datagrid_center_day_button').addClass('focusbutton');
		$('#pm_datagrid_center_week_button').removeClass('focusbutton');
		$('#pm_datagrid_center_month_button').removeClass('focusbutton');
		$('#pm_datagrid_center_list_button').removeClass('focusbutton');
		$('#pm_datagrid_center_day_week').css('display', 'block');
		$('#pm_datagrid_center_month_list').css('display', 'none');
		$('#pm_datagrid_center_datagrid_daycontent').css('display', 'block');
		$('#pm_datagrid_center_datagrid_weekcontent').css('display', 'none');
		$('#pm_datagrid_center_month_list_montbcontent').css('display', 'none');
		//取得 day 数据
		ovaldate = date;
		ovaldateStr = formatCalendarDate(ovaldate,'-');
		$('#calendarID').calendar('moveTo', ovaldate);
		getVisiptplanDayData();
	   
	}
	
	/**
	* 点击日历刷新当前页面
	*/
	function calendarTipRefresh(date){
	    if(dayShow){
		    ovaldate = date ;
			ovaldateStr = formatCalendarDate(ovaldate,'-');
			$('#calendarID').calendar('moveTo', ovaldate);
			getVisiptplanDayData();
		}
		//如果当前显示位周 即 weekShow = true
		if(weekShow){
			ovaldate = date ;
			ovaldateStr = formatCalendarDate(ovaldate,'-');
			$('#calendarID').calendar('moveTo', ovaldate);
		    getVisiptplanWeekData();
		}
		//如果当前显示位月 即 monthShow = true
		if(monthShow){
		    ovaldate = date ;
		    ovaldateStr = formatCalendarDate(ovaldate,'-');
		    $('#calendarID').calendar('moveTo', ovaldate);
		    getMonthData();
		}
		//如果当前显示位列表 即 listShow = true
		if(listShow){
		    ovaldate = date ;
			ovaldateStr = formatCalendarDate(ovaldate,'-');
			$('#calendarID').calendar('moveTo', ovaldate);
		    getListItemData(transfer_orgid);
		}
		var visitplan_div = $('#pm_west_down_visitplan_div');
		var activity_div = $('#pm_west_down_activity_div');
		var other_div = $('#pm_west_down_other_div');
		if(divYesOrNoTip(ovaldate)){
		     visitplan_div.attr('disabled',true);
			 activity_div.attr('disabled',true);
			 other_div.attr('disabled',true);
		}else{
			 visitplan_div.attr('disabled',false);
			 activity_div.attr('disabled',false);
			 other_div.attr('disabled',false);
		}
	}
	
	/*显示周计划制定*/
	function showWeekPlanEdit() {
	    $('#dlg-wpe').dialog({
			closable: false,   
			cache: false,   
			href: 'WeekPlanEdit.html',   
			modal: true  
		});  
		$('#dlg-wpe').dialog('open');
		$('#dlg-wpe').dialog('refresh', 'WeekPlanEdit.html');
	}

	/*显示约定拜访*/
	function showFeedbackMain(idx) {
		if(idx!=undefined){
			visitfeedbackid = idx;
			$('#editFeedbackBtn').show();
			$('#delFeedbackBtn').show();
		}else{		
			visitfeedbackid = null;
			$('#editFeedbackBtn').hide();
			$('#delFeedbackBtn').hide();
		}
		$('#dlg-ydm').dialog({
			closable: false,   
			cache: false,   
			href: 'FeedBackMainForHospital.html',   
			modal: true  
		});  
		$('#dlg-ydm').dialog('refresh', 'FeedBackMainForHospital.html');
	}

	/*显示活动会议*/
	function showActivityMain(idx) {
		if(idx!=undefined){
			visitfeedbackid = idx;
			$('#editActivityBtn').show();
			$('#delActivityBtn').show();
		}else{		
			visitfeedbackid = null;
			$('#editActivityBtn').hide();
			$('#delActivityBtn').hide();
		}
		$('#dlg-atm').dialog({
			closable: false,   
			cache: false,   
			href: 'ActivityMain.html',   
			modal: true  
		});  
		$('#dlg-atm').dialog('open');
		$('#dlg-atm').dialog('refresh', 'ActivityMain.html');
	}

	/*显示其他事项*/
	function showOtherEdit(idx) {
		if(idx!=undefined){
			visitotherinfoid = idx;
			$('#delOtherBtn').show();
		}else{		
			visitotherinfoid = null;
			$('#delOtherBtn').hide();
		}
		$('#dlg-ote').dialog({
			closable: false,   
			cache: false,   
			href: 'OtherEdit.html',   
			modal: true  
		});  
		$('#dlg-ote').dialog('open');
		$('#dlg-ote').dialog('refresh', 'OtherEdit.html');
	}
	
	function selectModel(model,idx){
		if(model==1 || model=='1')showFeedbackMain(idx);
		if(model==2 || model=='2')showOtherEdit(idx);
		if(model==3 || model=='3')showActivityMain(idx);	
	}
	
	/*周工作总结*/
	function getWorkSummary(){
		paramsstr = "{'cudate':'"+ovaldateStr+"','employeeid':"+oval_user_search+"}";
		var variable = new Array('__methodName', '__token', 'pagename', 'actionname','__params');
		var value = new Array('wsActionJSON', token, 'p_worksummary', 'getworksummary',paramsstr);
		var dataStr = getJsonData(variable, value);
		connectionServlet(dataStr, getWorkSummaryReturn);
	}	
	
	function getWorkSummaryReturn(data){
		if(data.successflag == 'true'){
			$('#createContainer').html('<div id="dlg-wws-area"></div>');
			var worksummary = "";
			var bossopinion = "";
			if(data.result.visitplaninfo.worksummary!=undefined)
				worksummary = data.result.visitplaninfo.worksummary;
			if(data.result.visitplaninfo.bossopinion!=undefined)
				bossopinion = data.result.visitplaninfo.bossopinion;
			$('#dlg-wws-area').dialog({   			
				title: data.result.dates.weekrange+'周工作总结', 
				width: 550,   
				height: 255, 
				modal: true , 
				buttons: [{
					text:'保存',
					iconCls:'icon-save',
					handler:function(){
						var worksummary = $('#txtWorkSummary').val();
						var bossopinion = $('#txtBossOpinion').val();
						var visitplanid = $('#oval_visitplanid').val();
						paramsstr = "{'cudate':'"+ovaldateStr+"','employeeid':"+oval_user_search+",'visitplanid':'"+visitplanid+"','worksummary':'"+worksummary+"','bossopinion':'"+bossopinion+"'}";
						var variable = new Array('__methodName', '__token', 'pagename', 'actionname','__params');
						var value = new Array('wsActionJSON', token, 'p_worksummary', 'saveworksummary',paramsstr);
						var dataStr = getJsonData(variable, value);
						connectionServlet(dataStr, saveWorkSummaryReturn);		
					}
				}],
				content: '<table style="margin:10px"><tr><td width="25%" class="westtable-span1">工作总结：</td><td width="75%" class="westtable-span1"><textarea id="txtWorkSummary" style="width:400px;height:70px">'+worksummary+'</textarea></td></tr><tr><td class="westtable-span1">主管意见：</td><td class="westtable-span1"><textarea id="txtBossOpinion" style="width:400px;height:70px">'+bossopinion+'</textarea></td></tr><table><input type="hidden" id="oval_visitplanid"/>'
			}); 
			if(data.result.visitplaninfo.visitplanid!=undefined)
				$('#oval_visitplanid').val(data.result.visitplaninfo.visitplanid);
			$('.dialog-button').css({'background':'#dbeaf9'});
		}
	}
	
	function saveWorkSummaryReturn(data){
		if(data.successflag == 'true'){
			$('#dlg-wws-area').dialog('destroy');
		}
	}
</script>
</body>
</html>
